<template>
	<view class="body">
		<view class="deatil">
			<view class="shop">
				<image :src="query.shop_info.category_image" mode="aspectFill" class="logo"></image>
				<view class="name">
					{{query.shop_info.name}}
				</view>
			</view>
			<view class="message">
				<view class="card">
					<image :src="query.image" mode="aspectFill" class="img"></image>
					<view class="right1">
						<view class="top1">
							<view class="name1">
								{{query.title}}
							</view>
							<view class="num">
								<view class="unit">
									￥
								</view>
								<view class="price">
									{{query.unit}}
								</view>
							</view>
						</view>
						<view class="top2">
							<view class="name2">
								{{query.form_str}}
							</view>
							<view class="num2">
								x{{query.amount}}
							</view>
						</view>
					</view>
				</view>
				<view class="coupon">
					<view class="name3">
						优惠券
					</view>
					<view class="right3">
						-￥{{query.coupon_cost}}
					</view>
				</view>
			</view>
			<view class="three_box pt1">
				<view class="row2 mb">
					<view class="name5">
						实付
					</view>
					<view class="num">
						<view class="unit red">
							￥
						</view>
						<view class="price red">
							{{query.pay_cost}}
						</view>
					</view>
				</view>
				<view class="row2 mb">
					<view class="name5">
						订单编号
					</view>
					<view class="right7">
						<view class="size1">
							{{query.order_no}}
						</view>
						<view class="size2" @click="copyText(query.order_no)">
							复制
						</view>
					</view>
				</view>
				<view class="row2 mb" v-if="query.petname">
					<view class="name5">
						会员姓名
					</view>
					<view class="right7">
						<view class="size1">
							{{query.petname}}
						</view>
					</view>
				</view>
				<view class="row2 mb" v-if="query.telephone">
					<view class="name5">
						会员手机号
					</view>
					<view class="right7">
						<view class="size1">
							{{query.telephone}}
						</view>
					</view>
				</view>
				<view class="row2 mb">
					<view class="name5">
						支付方式
					</view>
					<view class="right7">
						<view class="size1">
							{{query.pay_str}}
						</view>
					</view>
				</view>
				<view class="row2">
					<view class="name5">
						支付时间
					</view>
					<view class="right7">
						<view class="size1">
							{{query.pay_time?query.pay_time:'暂无时间'}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="deatil" v-if="JSON.stringify(query.card_info) !== '{}'">
			<view class="three_box">
				<view class="row2 mb">
					<view class="name5">
						可用门店
					</view>
					<view class="right7">
						<view class="size1">
							{{query.card_info.place_name}}
						</view>
					</view>
				</view>
				<view class="row2">
					<view class="name5">
						有效天数
					</view>
					<view class="right7" >
						<view class="size1">
							{{query.card_info.day_str}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="deatil" v-if="JSON.stringify(query.coach_info) !== '{}'">
			<view class="three_box">
				<view class="row2 mb">
					<view class="name5">
						上课场地
					</view>
					<view class="right7">
						<view class="size1">
							{{query.coach_info.place_name}}
						</view>
					</view>
				</view>
				<view class="row2">
					<view class="name5">
						上课教练
					</view>
					<view class="right7" >
						<image :src="query.coach_info.avatar" mode="aspectFill"
							class="uimg" ></image>
						<view class="size1">
							{{query.coach_info.nickname}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="deatil" v-if="JSON.stringify(query.user_info) !== '{}'">
			<view class="three_box">
				<view class="row2 mb">
					<view class="name5">
						领取时间
					</view>
					<view class="right7">
						<view class="size1">
							{{query.user_info.draw_time?query.user_info.draw_time:'暂无时间'}}
						</view>
					</view>
				</view>
				<view class="row2">
					<view class="name5">
						领取人
					</view>
					<view class="right7">
						<image :src="query.user_info.avatar" mode="aspectFill"
							class="uimg"></image>
						<view class="size1">
							{{query.user_info.nickname}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import{
		storeorderInfo
	} from '@/api/manager.js'
	export default {
		data() {
			return {
				type: 1,
				query:{}
			}
		},
		methods: {
			getStoreorderInfo(e){
				storeorderInfo(e).then(({data:res})=>{
					console.log('res', res);
					if(res.code == 1){
						this.query = res.data
					}
				})
			},
			copyText(e) {
				uni.setClipboardData({
					data: e,
					success: function() {
						uni.showToast({
							title: '复制成功',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			onLoad(e){
				console.log('e', e);
				this.getStoreorderInfo(e)
			},
			routeCoach(){
				
				
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #e9e9e9;
	}

	.body {
		padding: 0 24rpx 0;

		.deatil {
			margin-top: 24rpx;
			width: 100%;
			background: #ffffff;
			border-radius: 16rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			padding: 32rpx 32rpx;

			.shop {
				display: flex;
				flex-direction: row;
				width: 100%;
				padding-bottom: 22rpx;
				border-bottom: 1rpx solid #e9e9e9;

				.logo {
					width: 114rpx;
					height: 36rpx;
					margin-right: 12rpx;
				}

				.name {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC-Bold;
					font-weight: 700;
					text-align: left;
					color: #333333;
				}
			}
		}

		.message {
			padding: 26rpx 0 22rpx;
			width: 100%;
			border-bottom: 1rpx solid #e9e9e9;
			display: flex;
			flex-direction: column;

			.card {
				width: 100%;
				display: flex;
				flex-direction: row;
				margin-bottom: 20rpx;

				.img {
					width: 160rpx;
					height: 120rpx;
					margin-right: 20rpx;
				}

				.right1 {
					display: flex;
					flex-direction: column;
					flex: 1;

					.top1 {
						display: flex;
						flex-direction: row;
						align-items: center;
						width: 100%;
						margin-bottom: 8rpx;

						.name1 {
							font-size: 32rpx;
							font-family: PingFang SC, PingFang SC-Bold;
							font-weight: 700;
							text-align: left;
							color: #333333;
							flex: 1;
						}
					}

					.top2 {
						display: flex;
						flex-direction: row;
						align-items: center;
						width: 100%;

						.name2 {
							font-size: 24rpx;
							font-family: PingFang SC, PingFang SC-Medium;
							font-weight: 500;
							text-align: left;
							color: #999999;
							flex: 1;
						}

						.num2 {
							font-size: 24rpx;
							font-family: PingFang SC, PingFang SC-Regular;
							font-weight: 400;
							color: #666666;
						}
					}
				}
			}

			.coupon {
				width: 100%;
				display: flex;
				flex-direction: row;
				align-items: center;

				.name3 {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC-Bold;
					font-weight: 700;
					color: #333333;
					letter-spacing: 0.62rpx;
					flex: 1;
				}

				.right3 {
					font-size: 32rpx;
					font-family: DIN, DIN-Bold;
					font-weight: 700;
					text-align: left;
					color: #333333;
				}
			}
		}

		.pt1 {
			padding-top: 28rpx;
		}

		.three_box {
			width: 100%;
			display: flex;
			flex-direction: column;

			.mb {
				margin-bottom: 32rpx;
			}

			.row2 {
				display: flex;
				flex-direction: row;
				align-items: center;


				.uimg {
					width: 40rpx;
					height: 40rpx;
					background: rgba(0, 0, 0, 0.00);
					border-radius: 50%;
					margin-right: 8rpx;
				}

				.name5 {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC-Bold;
					font-weight: 700;
					text-align: left;
					color: #333333;
					letter-spacing: 0.62rpx;
					flex: 1;
				}

				.red {
					color: #F37364;
				}

				.right7 {
					display: flex;
					flex-direction: row;
					align-items: center;

					.size1 {
						font-size: 28rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						color: #000000;
					}

					.size2 {
						margin-left: 11rpx;
						font-size: 28rpx;
						font-family: PingFang SC, PingFang SC-Regular;
						font-weight: 400;
						text-align: left;
						color: #666666;
					}
				}
			}
		}
	}

	.num {
		display: flex;
		flex-direction: row;
		align-items: baseline;

		.unit {
			font-size: 24rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #333333;
		}

		.price {
			font-size: 32rpx;
			font-family: DIN, DIN-Bold;
			font-weight: 700;
			text-align: left;
			color: #333333;
		}
	}

	.ml {
		margin-left: 11rpx;
	}
</style>